function t() {
    return (t = Object.assign || function(t) {
        for (var e = 1; e < arguments.length; e++) {
            var n = arguments[e];
            for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
        }
        return t;
    }).apply(this, arguments);
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var e = [], n = function(n) {
    return new Promise(function(o, r) {
        var s = getCurrentPages(), c = s[s.length - 1].selectComponent(n.selector);
        delete n.selector, c && (c.setData(t({
            onCancel: r,
            onConfirm: o
        }, n)), e.push(c));
    });
};

n.defaultOptions = {
    show: !0,
    title: "",
    message: "",
    zIndex: 100,
    overlay: !0,
    asyncClose: !1,
    selector: "#van-dialog",
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    showConfirmButton: !0,
    showCancelButton: !1,
    closeOnClickOverlay: !1,
    confirmButtonOpenType: ""
}, n.alert = function(e) {
    return n(t({}, n.currentOptions, e));
}, n.confirm = function(e) {
    return n(t({}, n.currentOptions, {
        showCancelButton: !0
    }, e));
}, n.close = function() {
    e.forEach(function(t) {
        t.close();
    }), e = [];
}, n.setDefaultOptions = function(t) {
    Object.assign(n.currentOptions, t);
}, n.resetDefaultOptions = function() {
    n.currentOptions = t({}, n.defaultOptions);
}, n.resetDefaultOptions(), exports.default = n;